package com.qu.waibao.my.fragment;

import android.os.Bundle;
import android.view.View;

import com.qu.waibao.base.BaseViewPagerFragment;
import com.qu.waibao.base.BaseViewPagerSfragment;
import com.qu.waibao.publisher.PublisherFragment;

/**
 * @描述 describe
 * @作者 Administrator
 * @创建时间 2018/7/24 9:20
 * @邮箱 1123599561@qq.com
 */
public class PublishOrderViewPageFragment extends BaseViewPagerSfragment {
    private String type = "";
    @Override
    protected void initBundle(Bundle bundle) {
        super.initBundle(bundle);
        if(bundle != null){
            type = bundle.getString("type","more");
        }
    }

    @Override
    protected void initWidget(View root) {
        super.initWidget(root);
        if(type.equals("finished")){
            mBaseViewPager.setCurrentItem(4,true);
        }else if(type.equals("finishing")){
            mBaseViewPager.setCurrentItem(3,true);
        }else if(type.equals("unpaid")){
            mBaseViewPager.setCurrentItem(1,true);
        }else if(type.equals("qiang")){
            mBaseViewPager.setCurrentItem(2,true);
        }
    }

    @Override
    protected PagerInfo[] getPagers() {
        return new PagerInfo[]{
                new PagerInfo("全部",PublishOrderFragment.class,getBundle("")),
                new PagerInfo("待支付",PublishOrderFragment.class,getBundle("待支付")),
                new PagerInfo("待抢单",PublishOrderFragment.class,getBundle("待抢单")),
                new PagerInfo("待完成",PublishOrderFragment.class,getBundle("待完成")),
                new PagerInfo("已完成",PublishOrderFragment.class,getBundle("已完成"))
        };
    }

    private Bundle getBundle(String type) {
        Bundle bundle = new Bundle();
        bundle.putString("type",type);
        return bundle;
    }
}
